package com.hrt.web.product.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.hrt.base.BaseDaoImpl;
import com.hrt.bean.GiftType;
import com.hrt.web.product.dao.GiftTypeWebDao;

@Repository
public class GiftTypeWebDaoImpl extends BaseDaoImpl<GiftType> implements GiftTypeWebDao{
	
	@SuppressWarnings("unchecked")
	@Override
	public List<GiftType> findDelAll() {
		
		return getHibernateTemplate().find("FROM GiftType WHERE isDelete=0");
	}

	/**查询礼品分类子级*/
	@SuppressWarnings("unchecked")
	@Override
	public List<GiftType> findDelSonById(Long id) {
		return getHibernateTemplate().find("FROM GiftType type WHERE type.isdelete=0 and type.parentId="+id);
	}
	
	/**查询礼品分类子级*/
	@SuppressWarnings("unchecked")
	@Override
	public List<GiftType> findDelParents() {
		return getHibernateTemplate().find("FROM GiftType type WHERE type.isdelete=0 and type.parentId=null");
	}

}
